package net.uhuijia.goods.goodskuprice.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.netflix.discovery.converters.Auto;

import net.uhuijia.appbase.service.CrudService;
import net.uhuijia.goods.goodskuprice.persistence.dao.GoodSkuPriceDao;
import net.uhuijia.goods.goodskuprice.persistence.model.GoodSkuPrice;
import net.uhuijia.goods.goodskuprice.persistence.model.GoodSkuPriceExample;
import net.uhuijia.goods.goodskuprice.service.GoodSkuPriceService;


@Service
@Transactional
public class GoodSkuPriceServiceImpl
     extends CrudService<GoodSkuPriceDao,GoodSkuPrice,GoodSkuPriceExample>
     implements  GoodSkuPriceService {
	
	@Autowired
	private GoodSkuPriceService goodSkuPriceService;

	@Override
	public GoodSkuPrice addGoodSkuPrice(String goodId, String goodSkuId, int limitCount, Double price, String unit) {
		GoodSkuPrice goodSkuPrice = new GoodSkuPrice();
		this.initDefalutFields(goodSkuPrice);
		goodSkuPrice.setGoodId(goodId);
		goodSkuPrice.setGoodSkuId(goodSkuId);
		goodSkuPrice.setLimitCount(limitCount);
		goodSkuPrice.setPrice(price);
		goodSkuPrice.setUnit(unit);
		
		goodSkuPriceService.add(goodSkuPrice);
		return goodSkuPrice;
	}
}